//
//  FirstViewController.m
//  UI11_Xib CustomCell
//
//  Created by dllo on 16/7/28.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "FirstViewController.h"
#define kTableView @"reuse"
#define kTableViewSec @"secReuse"

#import "NewsTableViewCell.h"
#import "SecTableViewCell.h"

@interface FirstViewController () <UITableViewDataSource, UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *newsTableView;

@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    // 1. 自定义tableViewCell创建cell时 勾选also create xib file
    // 2. 在xib文件中进行cell布局 (注意设置和模拟器相对应的尺寸)
    // 3. 通过自定义cell的Xib文件注册cell
    [self.newsTableView registerNib:[UINib nibWithNibName:@"NewsTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kTableView];
//    [self.newsTableView registerNib:[UINib nibWithNibName:@"SecTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kTableViewSec];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//    if (indexPath.row % 2) {
//        SecTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kTableViewSec];
//        return cell;
//    } else {
    NewsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kTableView];

    return cell;
//    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
